home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 October
/
1986-10.d64
/
dir extension
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
133 lines
100 poke 53280,15:poke 53281,15:print"[147] directory extension"
110 print" [163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
120 for i=830 to 902:read d:poke i,d:next
130 dn$="":p$="[175][157][157][170] [146][180][157][157][183]":xx=1
140 mt$=" [146] [144]"
150 dm=144:dim f$(dm),s$(dm),t$(dm),s2$(dm)
160 for i=0 to dm:f$(i)=chr$(32)+" ":next
170 print"[145] reading directory ":open1,8,0,"$":sys 830:close 1
180 gosub 950
190 poke 198,0:print"[147]"spc(9)p$"[145][157]1[146]"spc(3)"view directory file"
200 print""spc(9)p$"[145][157]2[146]"spc(3)"send disk commands"
210 print""spc(9)p$"[145][157]3[146]"spc(3)"save"
220 print""spc(9)p$"[145][157]4[146]"spc(3)"view different disk"
230 print""spc(9)p$"[145][157]5[146]"spc(3)"quit"
240 print""spc(28)p$"[145][157] [146]":print"[145]"spc(9)"enter your choice [170][191][157]";
250 poke 204,0:get cg$:if cg$<"1" or cg$>"5" then 250
260 poke 204,1:poke 207,0:print""cg$:cg=val(cg$)
270 on cg goto 290,1090,520,1240,1340
280 rem *** view files ***
290 c=peek(0)-1:a=1
300 if a=> c then 330
310 if a<0 and c/6=int(c/6) then a=c-5:goto 330
320 if a<0 then dn=int(c/6):a=dn*6+1
330 print"[147][144][146] disk title: "f$(0)" ":print"":pq=5
340 for i=a to a+pq
350 if f$(i)=chr$(32)+" " or f$(i)="" then f$(i)="":pq=pq-1
360 next
370 for i= a to a+pq
380 if i>9 then w$=" [157]":goto 400
390 w$=" [157]"
400 print"[157]"i;w$;left$(f$(i),16)":"mt$:print"[145][145]"spc(20);
410 print""s$(i)"[144]":next
420 print dn$" f1-menu f3-add f5-fwd f7-back ^-delete":poke 198,0:wait198,1
430 if peek(197)=54 then 1280
440 if peek(197)=4 then 190
450 if peek(197)=5 then 610
460 if peek(197)=6 and a=c then a=1:goto 300
470 if peek(197)=6 and a+6>c then a=1:goto 300
480 if peek(197)=6 and a<c then a=a+6:goto 300
490 if peek(197)=3 then a=a-6:goto 300
500 goto 430
510 rem *** save descriptions ***
520 print"[145][145]"spc(28)" [157] ":print"[145][145]"spc(9)" saving "chr$(34)"dir file";
530 print chr$(34)"...":for r=1 to c:if s$(r)="" then s$(r)=" "
540 next r
550 close1:close 15:open 1,8,15,"s0:dir file":close 1:open 15,8,15,"i"
560 open 1,8,8,"0:dir file,s,w":gosub 1050
570 print#1,c
580 for i=1 to c:print#1,left$(f$(i),16):print#1,s$(i):next:close 1
590 print"[145] ":goto 190
600 rem *** add statements ***
610 printdn$""spc(9)"f3-add"
620 print dn$" enter file[160]#";:poke 198,0:input fi$:fi=val(fi$)
630 if fi$="0" then printdn$" ":goto 420
640 if fi<a or fi>a+pq then print dn$ spc(17)" ":goto 610
650 print dn$" ":if fi<7 then z=fi:goto 680
660 z=int(fi/6)+1:dd=z*6-fi:z=6-dd
670 if z=0 then z=6
680 print"":fori=1 to z:print"":next
690 f$(fi)=left$(f$(fi),16)
700 i$=""
710 print"[145]"spc(19)">"spc(len(i$));:b$="<":cc=len(b$):l=1
720 print""mid$(b$,l,2);"[157]";:l=-l*(l<cc)+1
730 get a$:if a$="" or a$=chr$(34) or a$=chr$(44) or a$=chr$(58) then 730
740 if a$=chr$(59) then 730
750 if a$=chr$(13) and len(i$)=18 then 910
760 if len(i$)=18 and a$<>chr$(20) then i$=i$+a$:print a$"[146] <[157]";:goto 720
770 if len(i$)=55 then pp=1
780 if len(i$)=55 and a$<>chr$(20) and a$<>chr$(13) then 730
790 if a$=chr$(13) and len(i$)=0 then 330
800 if a$=chr$(13) then 910
810 if a$=chr$(20) and len(i$)=19 then 880
820 if a$=chr$(20) and len(i$)>0 then 850
830 if asc(a$)<32 or asc(a$)>95 then 720
840 i$=i$+a$:print a$;:goto 720
850 i$=left$(i$,len(i$)-1)
860 if len(i$)=54 then print"[146] [157][157]";:goto 720
870 print" [157][157]";:goto 720
880 i$=left$(i$,len(i$)-1):print" ":d=19
890 if pp=1 then print"[145][145][145]"spc(38)"";:goto 720
900 print"[145][145]"spc(38)"";:goto 720
910 s$(fi)=i$
920 if len(s$(fi))<19 then 330
930 s$(fi)=mid$(s$(fi),1,19)+"[146] "+mid$(s$(fi),20,37)
940 s$(fi)=s$(fi)+"[145]":goto 330
950 open 15,8,15,"i"
960 open 1,8,8,"0:dir file,s,r":gosub 1050:if en=62 then close 15:return
970 print"[145]"spc(19)"dir file "
980 input#1,c
990 for i=1to c:input#1,t$(i):input#1,s$(i):s2$(i)=s$(i):next
1000 close 1:close 15:nf=peek(0)-1
1010 for a=1to nf:if left$(f$(a),16)=t$(a) then s$(a)=s2$(a):goto 1040
1020 for b=1 to c:if left$(f$(a),16)=t$(b) then s$(a)=s2$(b):b=c+2
1030 next b:if b=c+1 then s$(a)=""
1040 next a:return
1050 input#15,en,em$:if en=0 then return
1060 if en=62 and xx=1 then xx=0:return
1070 print"[147]disk error:";en;em$:print""spc(14)" ":end
1080 rem *** send disk commands ***
1090 print"[147] disk commands":print" commands":print"[160][163][163][163][163][163][163][163][163]"
1100 print" s0:filename"spc(11)"scratch a file
1110 [153]" r0:newname=oldname rename a file
1120 print" v0"spc(20)"validate a disk":print" i0"spc(20)"initialize"
1130 print" enter command (return for menu)":z$="":print" >";
1140 get u$:if u$="" then 1210
1150 if len(z$)=37 and u$<>chr$(13) and u$<>chr$(20) then 1140
1160 u=asc(u$):if u=13 then 1220
1170 if u<>20 then 1200
1180 if len(z$)<>0 then z$=mid$(z$,1,len(z$)-1):print u$;
1190 goto 1140
1200 if u<32 or u>90 then 1140
1210 print"<[157]";u$;:z$=z$+u$:goto 1140
1220 if z$="" then 190
1230 close1:open 1,8,15,z$:close 1:close 15:open 15,8,15,"i":gosub 1050:goto190
1240 print"[147] insert new disk into drive"
1250 print" press any key to continue":poke 198,0:wait 198,1:get e$
1260 print"[145] please wait ":clr:goto 130
1270 rem *** delete descriptions ***
1280 printdn$""spc(31)"^-delete"
1290 print dn$""spc(10)" "
1300 poke 198,0:fi$="":print dn$" delete #";:input fi$:fi=val(fi$)
1310 if fi$="0" then print dn$" ":goto 420
1320 if fi<a or fi>a+pq then 1280
1330 s$(fi)=" ":goto 330
1340 poke 198,0:sys 198:end
1350 data 169,255,133,0,165,55,133,71,165,56,133
1360 data 72,162,1,32,198,255,166,0,232,134,0
1370 data 216,56,165,71,233,20,133,71,176,5,166
1380 data 72,202,134,72,32,207,255,164,144,208
1390 data 22,201,34,208,245,160,0,32,207,255,201
1400 data 34,240,249,145,71,200,192,19,208,242
1410 data 240,207,32,204,255,96,0,0,0